package com.dyypdadmin.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dyypdadmin.pojo.Doctors;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.List;

@Mapper
public interface DoctorsDao extends BaseMapper<Doctors> {
    // 添加医生信息
    @Insert("insert into doctors(doctor_name,doctor_gender,expertise,years_of_experience,contact_number) values (#{doctor_name},#{doctor_gender},#{expertise},#{years_of_experience},#{contact_number})")
    int addDoctor(@Param("doctor_name") String doctor_name,
                  @Param("doctor_gender") String doctor_gender,
                  @Param("expertise") String expertise,
                  @Param("years_of_experience") Integer years_of_experience,
                  @Param("contact_number") String contact_number);
    // 逻辑删除医生
    @Update("update doctors set is_employed=0 and is_appointment_available=0 where doctor_id=#{doctor_id}")
    int delDoctor(@Param("doctor_id")int doctor_id);
    //根据名字模糊查询
    @Select("select * from doctors where doctor_name like #{doctor_name}")
    List<Doctors> getDoctorByName(@Param("doctor_name")String doctor_name);
}
